﻿@model Tasks.UI.Models.Account.EmployeeEditModel
@{
    Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>员工编辑</title>
    <link href="@Config.GetCssResourcePath("main.css")" rel="stylesheet" type="text/css" />
    <link href="@Config.GetCssResourcePath("table.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Scripts/jquery-impromptu.3.1.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.combobox.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-impromptu.3.1.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/global.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            // 手机号码验证
            jQuery.validator.addMethod("ismobile", function (value, element) {
                var length = value.length;
                return this.optional(element) || (length == 11 && /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/.test(value));
            }, "请正确填写您的手机号码");
            $("#form1").validate({
                errorPlacement: function (error, element) {
                    error.appendTo(element.parent())
                },
                rules: {
                    AccountNo: "required",
                    Name: "required",
                    Birthday: {
                        required: true,
                        dateISO: true
                    },
                    MobileNo: {
                        ismobile: true
                    }
                },
                messages: {
                    AccountNo: "请输入账号",
                    Name: "请输入姓名",
                    Birthday: {
                        required: "请输入生日",
                        dateISO: "请输入正确格式的日期"
                    },
                    MobileNo: {
                        ismobile: "请正确填写您的手机号码"
                    }
                }
            });
            $("#DeptName").combobox({
                ColumnsMapsNodeName: 'ID|Name',
                TagObject: null,
                MustMatching: false,
                ListWidth: 250,
                DisplayHead: true,
                ListType: ListType.Combobox,
                DataType: DataType.Xml,
                DataLoadOnce: false,
                RemoteUrl: "/data/getxmldata?datatype=dept&keyword=",
                TextFormat: 'V1',
                ValueFormat: 'V0,V1',
                OnItemClickEvent: function (src, data) {
                    var arrmp = data.value.split(",");
                    $("#DeptID").attr("value", arrmp[0]);
                    $("#DeptName").attr("value", arrmp[1]);
                },
                HeadColumn: [
            { name: "编号", width: 60 },
            { name: "部门名称" }
            ],
                KeyWordColumn: '',
                Buttons: [
            { text: "添加", event: function () { parent.showModalDialog('/Dict/Manage?dictKey=DEPT', false); } }
            ]
            });

        });

        //init
        $(function () {
            datePicker("#Birthday");
        })
        //密码修改
        function ChangePassword(UserID) {
            $("#UserID").val(UserID);
            $("#act").val("changepassword");
            $("#form1").submit();
        }
    </script>
</head>
<body>
    <form action="EditEmployee" method="post" id="form1">
    <div id="container">
        <div class="navTitle">
            <ul>
                <li class="Home SecondLast"><a href="index.php">
                    <div class="HomeIcon">
                    </div>
                    <font><font>Home</font></font></a></li><li class="Last"><span><font><font>编辑员工资料</font></font></span></li>
            </ul>
        </div>
        <h1>
            <font><font class="">编辑员工资料</font></font>
        </h1>
        <p class="intro">
            <font><font>你的员工信息如下。</font><font class="">点击“保存员工”按钮来保存员工信息。添加完员工后请为员工分配权限。 </font>
            </font>
        </p>
        <div class="cpsoso">
            <div class="cpsosoleft">
                <button id="Submit1" class="" type="submit">
                    <span>保存并继续编辑</span>
                </button>
                <button id="btnCancel" class="" type="button" onclick="closeTab()">
                    <span>取消</span>
                </button>
            </div>
        </div>
        @Html.OutputMessage(Model.Message, Model.MessageType)
        <div id="linefeed">
            <input id="act" name="act" type="hidden" />
            <div>
                <table border="0">
                    <tr>
                        <td width="80" align="left">
                            <strong>姓名:</strong>
                        </td>
                        <td align="left">
                            @Html.TextBoxFor(t => t.Name, new { id = "Name" })
                            @Html.HiddenFor(t => t.UserID, new { id = "UserID" })
                        </td>
                        <td width="80" align="left">
                            <strong>*帐号:</strong>
                        </td>
                        <td align="left">
                            @if (Model.UserID > 0)
                            {
                                @Html.TextBoxFor(t => t.AccountNo, new { disabled = "disabled" })
                                @Html.HiddenFor(t => t.AccountNo)
                            }
                            else
                            { 
                                @Html.TextBoxFor(t => t.AccountNo, new { id = "AccountNo", name = "AccountNo" })
                            }
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <strong>性别:</strong>
                        </td>
                        <td align="left">
                            @Html.DropDownList("Sex", Tasks.Core.PageHelper.SexSelector(Model.Sex))
                        </td>
                        <td align="left">
                            <strong>密码:</strong>
                        </td>
                        <td>
                            @Html.PasswordFor(t => t.Password, new { id = "Password", name = "Password" })
                            @if (Model.UserID > 0)
                            {
                                <a href="javascript:void(0)" onclick="ChangePassword(@Model.UserID)">修改密码</a>
                            }
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <strong>生日:</strong>
                        </td>
                        <td align="left">
                            @Html.TextBoxFor(t => t.Birthday, new { @readonly = "true" })<br />
                            <p>
                            </p>
                        </td>
                        <td align="left">
                            <strong>所属部门:</strong>
                        </td>
                        <td align="left">
                            @Html.HiddenFor(t => t.DeptID)
                            @Html.TextBoxFor(t => t.DeptName)
                            @*     @Html.DropDownList("DeptID", Tasks.Core.PageHelper.DeptSelector(Model.DeptID))*@
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <strong>手机号码:</strong>
                        </td>
                        <td colspan="3" align="left">
                            @Html.TextBoxFor(t => t.MobileNo)<br />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <strong>座机:</strong>
                        </td>
                        <td colspan="3" align="left">
                            @Html.TextBoxFor(t => t.LinkmanTel)<br />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <strong>传真:</strong>
                        </td>
                        <td colspan="3" align="left">
                            @Html.TextBoxFor(t => t.LinkmanFax)<br />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <strong>邮编:</strong>
                        </td>
                        <td colspan="3" align="left">
                            @Html.TextBoxFor(t => t.PostalCode)
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <strong>邮箱:</strong>
                        </td>
                        <td colspan="3" align="left">
                            @Html.TextBoxFor(t => t.EMail)
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <strong>详细地址:</strong>
                        </td>
                        <td colspan="3" align="left">
                            @Html.TextBoxFor(t => t.Address, new { style = "width:595px" })
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <strong>备注:</strong>
                        </td>
                        <td colspan="3" align="left">
                            @Html.TextAreaFor(t => t.Remark, new { style = "width:600px;height:100px" })
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <div class="cpsoso">
            <div class="cpsosoleft">
                <button id="Submit1" class="" type="submit">
                    <span>保存并继续编辑</span>
                </button>
                <button id="btnCancel" class="" type="button" onclick="closeTab()">
                    <span>取消</span>
                </button>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
